package com.plian.system.wrapper.wbdsh;

import com.plian.system.dto.ms.DailyThingDTO;
import com.plian.system.dto.wbdsh.WbdsDailyThingDTO;
import com.plian.system.entity.ms.DailyThing;
import com.plian.system.entity.wbdsh.WbdsDailyThing;
import com.plian.system.mybatis.support.BaseWrapper;
import com.plian.system.vo.ms.DailyThingVO;
import com.plian.system.vo.wbdsh.WbdsDailyThingVO;
import com.plian.system.wrapper.util.CacheWrapperUtil;
import com.plian.system.wrapper.util.WrapperUtil;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import static com.plian.system.wrapper.util.WrapperConstant.*;

/**
 * 日常事物报告表包装类,返回视图层所需的字段
 *
 * @author jianglei
 * @since 2019-10-23
 */
@Mapper(componentModel = SPRING, uses = {CacheWrapperUtil.class, WrapperUtil.class})
public interface WbdsDailyThingWrapper extends BaseWrapper<WbdsDailyThing, WbdsDailyThingDTO, WbdsDailyThingVO> {

	/**
	 * Entity转VO
	 *
	 * @param entity /
	 * @return /
	 */
	@Override
	@Mappings(value = {
			@Mapping(source = "fillCompanyId", target = "fillCompanyName", qualifiedByName = ORG_ID_TO_NAME),
			@Mapping(source = "createUser", target = "createUserName", qualifiedByName = USER_ID_TO_NAME),
			@Mapping(source = "updateUser", target = "updateUserName", qualifiedByName = USER_ID_TO_NAME),
			@Mapping(source = "approvedUser", target = "approvedUserName", qualifiedByName = USER_ID_TO_NAME)
	})
	WbdsDailyThingVO entityToVO(WbdsDailyThing entity);
}
